const passport = require('passport');
const Account = require('../models/mongo-account');

module.exports = () => {
  passport.serializeUser((user, done) => {
    console.log('user: ', user);
    done(null, user.id);
  });

  passport.deserializeUser((id, done) => {
    console.log('id: ', id);
    Account.findById(id, (err, user) => {
      done(err, user);
    });
  });
};
// Passport's Config
// passport.use(new LocalStrategy(Account.authenticate())); // 老方法
// passport.use(Account.createStrategy()); // 简化方法
// passport.serializeUser(Account.serializeUser());
// passport.deserializeUser(Account.deserializeUser());
